Scanning probe microscopes (SPMs), such as atomic force microscopes (AFMs) and scanning tunneling microscopes (STMs), are valuable tools for probing the topography and surface properties of materials. At high scan speeds, the scanner that drives the motion of the sample may resonate, causing resonance oscillations to appear in SPM images of the sample. To alleviate these resonance effects, a sensor that directly measures the lateral dynamics of the scanner can be attached to the scanner. A filter accepts the signals from the resonance sensor and employs a full dynamics characterization of the scanner based on the received signals in order to remove the resonance from the scanner motion.